const app = getApp();
Page({
  data: {
    page: 0,
  },
  onLoad: function (options) {
    this.getInfo();
  },
  getInfo(){
    var that = this;
    let page = that.data.page + 1;
    wx.showLoading({
      title: '加载中...',
    })

    app.request('score.order/index', { page }, 'GET', false, function (res) {
      that.setData({
        pageShow: true,
        page: page,
        list: res.data.data.data,
      })
    })
  },
  receipt(e){
    let that = this;
    let order_id = e.currentTarget.dataset.id;
    wx.showModal({
      title: '确认收货',
      content: '确认该商品已收到货物',
      success(res){
        if(res.confirm){
          app.request("score.order/receiveOrder", { order_id }, 'GET', false, function (res) {
            that.getInfo();
          })
        }
      }
    })
   
  },
  onReachBottom(){
    this.getInfo();
  }
})